<?php

namespace App\Models;


class Course extends Orm
{
    protected $table = 'course';
    protected $dateFormat = 'U';
    public $timestamps = true;

    public function setDiscoverAttribute($value)
    {
        $this->dealSetImageAttribute('discover', $value);
    }

    public function setVideoUrlAttribute($value)
    {
        $this->dealSetImageAttribute('video_url', $value);
    }

    public function getTagsAttribute($value)
    {
        return explode(',', $value);
    }

    public function setTagsAttribute($value)
    {
        $this->attributes['tags'] = implode(',', $value);
    }

    public function categoryInfo()
    {
        return $this->belongsTo(Category::class, 'category_id');
    }
}
